package com.etc.cure.controller;

import com.etc.common.utils.Result;
import com.etc.cure.entity.Hospital;
import com.etc.cure.service.HospitalService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/inHospital")
public class HospitalController {

    @Resource
    private HospitalService hospitalService;

    /**
     * 查询医生Id下的所有的住院病人信息
     */
    @RequestMapping("/queryByDocId")
    public Result queryByDocId(Integer pageNum, Integer pageSize, String docId) {
        return hospitalService.queryByDocId(pageNum, pageSize, docId);
    }
    /**
     * 根据门诊Id查询住院病人信息
     */
    @RequestMapping("/queryByOsId")
    public Result queryByOsId(String osId) {
        return hospitalService.queryByOsId(osId);
    }
    /**
     * 新增住院病人信息
     */
    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    public Result insert(@RequestParam String osId ,@RequestParam("docId") String docId) {
        return hospitalService.insert(osId,docId);
    }
    /**
     * 修改住院病人信息
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public Result update(@RequestBody Hospital hospital ,@RequestParam("docId") String docId) {
        return hospitalService.update(hospital,docId);
    }

}
